package com.vrv.app.cyberspace.modules.sys.controller;


import com.vrv.app.cyberspace.common.utils.JSONResult;
import com.vrv.app.cyberspace.common.validator.ValidatorUtils;
import com.vrv.app.cyberspace.modules.sys.entity.BaseTable;
import com.vrv.app.cyberspace.modules.sys.entity.RiskTable;
import com.vrv.app.cyberspace.modules.sys.service.IRiskTableService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author sm
 * @since 2017-12-15
 */
@Api(description="风险")
@RestController
@RequestMapping("/sys/risk")
public class RiskTableController extends BaseController {
    @Autowired
    private IRiskTableService riskTableService;

    @PostMapping()
    public JSONResult addRisk(BaseTable bt, RiskTable rt,String infrastructure_information) {
        ValidatorUtils.validateEntity(bt);
        ValidatorUtils.validateEntity(rt);
        bt.setCreateUserID(getUserId());
        return riskTableService.addRisk(bt, rt,infrastructure_information);
    }

    @PutMapping("/{id}")
    public JSONResult updateRisk(@PathVariable Integer id, BaseTable bt, RiskTable rt) {
        return riskTableService.updateRisk(id, bt, rt);
    }
}

